package com.shop.cereshop.app.tencent.im.model.msg;


import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.shop.cereshop.commons.tencent.im.model.msg.data.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;

/**
 * @description: 发送消息请求参数
 * @author zdd
 * @date 2025/9/3 14:36
 * @version 1.0
 */
@ApiModel("发送消息请求参数")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseSendMsgParam<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("消息类型(1:文本消息 2:地理位置消息 3:表情消息 4:自定义消息 5:语音消息 6:图像消息 7:文件消息 8:视频消息 99:红包消息)")
    @NotBlank(message = "msgType不能为空")
    private String msgType;

    @ApiModelProperty("发送者ID")
    private String senderId;

    @ApiModelProperty("群组ID，用于群发红包")
    private String groupId;

    @ApiModelProperty("接收者ID")
    private String receiverId;

    @ApiModelProperty("接收者名称")
    private String receiverName;

    @ApiModelProperty("消息数据")
    @Valid
    @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXTERNAL_PROPERTY, property = "msgType", defaultImpl = TextMsgData.class)
    @JsonSubTypes({
            @JsonSubTypes.Type(value = CustomMsgData.class, name = "custom"),
            @JsonSubTypes.Type(value = FaceMsgData.class, name = "face"),
            @JsonSubTypes.Type(value = FileMsgData.class, name = "file"),
            @JsonSubTypes.Type(value = ImageMsgData.class, name = "image"),
            @JsonSubTypes.Type(value = LocationMsgData.class, name = "location"),
            @JsonSubTypes.Type(value = SoundMsgData.class, name = "sound"),
            @JsonSubTypes.Type(value = TextMsgData.class, name = "text"),
            @JsonSubTypes.Type(value = VideoMsgData.class, name = "video")
    })
    private T msgData;

}
